package com.zhuss.intention.intention;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.zhuss.bean.bo.intention.intention.CreatePersonalIntentionBo;
import com.zhuss.bean.bo.intention.intention.DeletePersonalIntentionBo;
import com.zhuss.bean.bo.intention.intention.UpdatePersonalIntentionBo;
import com.zhuss.common.OperateService;
import com.zhuss.common.Processor;
import com.zhuss.exception.DzcxException;

/**
 * @description: 个人需求操作的Service
 * @author: zhushanshuo
 * @create: Fri Dec 25 09:39:45 CST 2020
 **/
@Component("personalIntentionOperateService")
public class PersonalIntentionOperateService implements OperateService<Void, Object> {
	
	@Autowired
	@Qualifier("personalIntentionCreate")
	private Processor<Object, CreatePersonalIntentionBo> personalIntentionCreate;
	
	@Autowired
	@Qualifier("personalIntentionUpdate")
	private Processor<Object, UpdatePersonalIntentionBo> personalIntentionUpdate;
	
	@Autowired
	@Qualifier("personalIntentionDelete")
	private Processor<Object, DeletePersonalIntentionBo> personalIntentionDelete;
	
	
	/**
	 * 创建
	 */
	@Override
    @Transactional(rollbackFor = Exception.class)
	public Void create(Object param) throws DzcxException {
		
		CreatePersonalIntentionBo bo = (CreatePersonalIntentionBo) param;
		
		personalIntentionCreate.process(bo);
		
		return null;
	}
    
	/**
	 * 修改
	 */
	@Override
    @Transactional(rollbackFor = Exception.class)
    public Void update(Object param) throws DzcxException {
    	
		UpdatePersonalIntentionBo bo = (UpdatePersonalIntentionBo) param;
		
		personalIntentionUpdate.process(bo);
		
    	return null;
    }
	
	/**
	 * 删除
	 */
	@Override
	@Transactional(rollbackFor = Exception.class)
	public Void delete(Object param) throws DzcxException {
		
		DeletePersonalIntentionBo bo = (DeletePersonalIntentionBo) param;
		
		personalIntentionDelete.process(bo);
		
		return null;
	}
	
}

